<!DOCTYPE html>
<html>
  <head>
    <link type="text/css" rel="stylesheet" href="/stylesheets/main.css" />
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
    
  </head>
<SCRIPT TYPE="text/javascript">
<!--

if (document.domain == "randomguestbook.appspot.com") 
{
    window.location.href = "http://the.randomchatroom.net"
}

function submitenter(myfield,e)
{
    var keycode;
    if (window.event) keycode = window.event.keyCode;
    else if (e) keycode = e.which;
    else return true;

    if (keycode == 13)
    {
       if (myfield.value != "") {
        myfield.form.submit();
       }
       return false;
    }
       return true;
}
function scheduleUpdate(){
    setTimeout('ajaxUpdate()', 15000);
}


function ajaxUpdate(){
    $.ajax({
      url: "messages",
      context: document.body,
      success: function(data, textStatus, jqXHR){
        $("#messages").html(data);
        scheduleUpdate();
      }
    });
        
}

scheduleUpdate();

//-->
</SCRIPT>
  
  <body>
      <div style="float: right"><a href="/info/about.html">About</a></div>
    <div>Hi! Please write something! Press enter to submit.</div>
    <form action="/messages" method="post">
        <div><textarea name="content" rows="3" cols="60" required="required" onKeyPress="return submitenter(this,event)"></textarea></div>
    </form>
    <a href="{{ url }}">{{ url_linktext }}</a>
    <br/>
    <br/>

    <div id="messages">
        {% for message in messages %}
        {{ message.author}} wrote {{ message.ago_minutes }} mins ago:
        <blockquote>{{ message.content|escape }}</blockquote>
        {% endfor %}
    </div>


  </body>
</html>
